﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAOTicketReservationSystem;

namespace OnlineReservation
{
    public partial class WebFormEvents : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["Date"] = DateTime.Now.AddDays(2);
        }

        protected void GridViewEvents_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            BuyTickets(this, e);
        }

        protected void GridViewFiltered_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            BuyTickets(this, e);
        }

        protected void BuyTickets(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes["onmouseover"] =
                   "this.style.background='#EEEEEE';this.style.cursor='hand'";
                e.Row.Attributes["onmouseout"] =
                    "this.style.background='white'";
                e.Row.Attributes["onclick"] = "location.href='WebFormPurchase.aspx?EventID=" + DataBinder.Eval(e.Row.DataItem, "EventID") + "'";
            }
        }        
    }
}